#encoding=utf8
'''
Created on 2012-10-17

@author: Administrator
'''
from Processor import Processor
from pub import Func, UserDict;
from pub.Config import Config;
from models import UserModel;

class USDClass(Processor):
    '''
    指令：USD(user see detail) 
    备注：玩家详情
    格式：c-s:cmd #cmdID#userID
     s-c:Cmd#cmdID#nickName#age# province# city#photo#desc
    '''
    def __init__(self,):
        Processor.__init__(self);
        self.__userId = 0;
        
    def dataValidtor(self, cmdContent):
        if not cmdContent:
            return False;
        paraLen = len(cmdContent);
        if paraLen == 1:      
            self.__userId = Func.strToInt(cmdContent[0], Config.I_SYS_ZERO);                  
            return True;        
        return False;
    def outData(self,):
        user = UserDict.getUserFromUserDictById(self.__userId);  
        if not user:
            userM = UserModel();
            user = userM.getUserInfoById(self.__userId, user);
        if not user:
            return False;
        sendData = [user.get_user_nick_name(), user.get_user_age(), user.get_user_province(), user.get_user_area(), user.get_user_photo(), user.get_user_sign()];
        sendStr = self.setPackage(sendData);
        Func.sendMsgStr(self._sockObj, sendStr);
        return True;
        
             
